<?php
/**
 * Created by PhpStorm.
 * User: aron
 * Date: 2019/5/8
 * Time: 5:18 PM
 */

namespace com\zyt\debug;

define("DEBUG_MODE_SHOW_ERROR", TRUE);

include_once "../../Util/DebugUtil/DebugUtil.php";


namespace com\zyt\order;
class Test {}
class User {
    public function say()
    {
        echo __NAMESPACE__;
        yt_debug_print_break_line();
        echo __CLASS__;
        yt_debug_print_break_line();
        echo "com\zyt\order say";
    }
}

namespace com\zyt\model;
class User {
    public function say()
    {
        echo __NAMESPACE__;
        yt_debug_print_break_line();
        echo __CLASS__;
        yt_debug_print_break_line();
        echo "com\zyt\model say";
    }
}


// 公共空间的函数和常量不用添加"\"也是可以滴
var_dump("");
\var_dump("");

namespace com\zyt\business;

// 调用公共空间的方式是直接在元素名称前加"\"就可以了
\DebugUtil::printDebugSeperator("use 引入命名空间");
use com\zyt\model\User;
$user = new User();
$user->say();

// 调用公共空间的方式是直接在元素名称前加"\"就可以了
\DebugUtil::printDebugSeperator("use 引入命名空间使用别名");
use com\zyt\model as m;
$user = new m\User();
$user->say();

\DebugUtil::printDebugSeperator("====use com\zyt\order;");
use com\zyt\order;
$user = new order\User();
$user->say();


\DebugUtil::printDebugSeperator("====use com\zyt\model;");
use com\zyt\model;
$user = new model\User();
$user->say();


\DebugUtil::printDebugSeperator("====use com\zyt\model\User as ModelUser;");
use com\zyt\model\User as ModelUser;
$user = new ModelUser();
$user->say();

\DebugUtil::printDebugSeperator("====use com\zyt\order\User as OrderUser;");
use com\zyt\order\User as OrderUser;
$user = new OrderUser();
$user->say();

\DebugUtil::printDebugSeperator("直接使用命名空间前缀");
$user = new \com\zyt\order\User();
$user->say();

\DebugUtil::printDebugSeperator();
echo "END";
